﻿USE [DBSystem]
GO
/****** Object:  Table [dbo].[Preferencia]    Script Date: 30/10/2013 06:59:42 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Preferencia](
	[Id] [int] IDENTITY(100,1) NOT NULL,
	[Descripcion] [varchar](200) NOT NULL,
 CONSTRAINT [PK_Preferencia] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[PreferenciasUsuario]    Script Date: 30/10/2013 06:59:42 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PreferenciasUsuario](
	[UsuarioId] [int] NOT NULL,
	[PreferenciaId] [int] NOT NULL,
 CONSTRAINT [PK_PreferenciasUsuario] PRIMARY KEY CLUSTERED 
(
	[UsuarioId] ASC,
	[PreferenciaId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Usuario]    Script Date: 30/10/2013 06:59:42 p.m. ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Usuario](
	[Id] [int] IDENTITY(100,1) NOT NULL,
	[Nombres] [varchar](200) NOT NULL,
 CONSTRAINT [PK_Usuario] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[Preferencia] ON 

GO
INSERT [dbo].[Preferencia] ([Id], [Descripcion]) VALUES (100, N'JAVA')
GO
INSERT [dbo].[Preferencia] ([Id], [Descripcion]) VALUES (101, N'RUBY')
GO
INSERT [dbo].[Preferencia] ([Id], [Descripcion]) VALUES (102, N'C#')
GO
INSERT [dbo].[Preferencia] ([Id], [Descripcion]) VALUES (103, N'C++')
GO
INSERT [dbo].[Preferencia] ([Id], [Descripcion]) VALUES (104, N'PHP')
GO
SET IDENTITY_INSERT [dbo].[Preferencia] OFF
GO
INSERT [dbo].[PreferenciasUsuario] ([UsuarioId], [PreferenciaId]) VALUES (100, 100)
GO
INSERT [dbo].[PreferenciasUsuario] ([UsuarioId], [PreferenciaId]) VALUES (100, 101)
GO
INSERT [dbo].[PreferenciasUsuario] ([UsuarioId], [PreferenciaId]) VALUES (100, 102)
GO
INSERT [dbo].[PreferenciasUsuario] ([UsuarioId], [PreferenciaId]) VALUES (100, 103)
GO
INSERT [dbo].[PreferenciasUsuario] ([UsuarioId], [PreferenciaId]) VALUES (100, 104)
GO
SET IDENTITY_INSERT [dbo].[Usuario] ON 

GO
INSERT [dbo].[Usuario] ([Id], [Nombres]) VALUES (100, N'Samuel')
GO
SET IDENTITY_INSERT [dbo].[Usuario] OFF
GO
ALTER TABLE [dbo].[PreferenciasUsuario]  WITH CHECK ADD  CONSTRAINT [FK_PreferenciasUsuario_Preferencia] FOREIGN KEY([PreferenciaId])
REFERENCES [dbo].[Preferencia] ([Id])
GO
ALTER TABLE [dbo].[PreferenciasUsuario] CHECK CONSTRAINT [FK_PreferenciasUsuario_Preferencia]
GO
ALTER TABLE [dbo].[PreferenciasUsuario]  WITH CHECK ADD  CONSTRAINT [FK_PreferenciasUsuario_Usuario] FOREIGN KEY([UsuarioId])
REFERENCES [dbo].[Usuario] ([Id])
GO
ALTER TABLE [dbo].[PreferenciasUsuario] CHECK CONSTRAINT [FK_PreferenciasUsuario_Usuario]
GO
